Skip to content

use options resolver where applicable, fix decoder plugin gzip handling #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2016

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Jan 25, 2016

follow up of the discussion in php-http/documentation#76 - i propose to use the OptionsResolver for configuration options on plugins. This is both more readable on the calling side and more flexible when we need to add more options in the future.

i mixed in the same PR a fix for the deccoder plugin to not claim to support gzip if it does not support gzip. this might hide the problem of a missing gzip library a bit.

@sagikazarmark
Copy link
Member

Huge 👍

@joelwurtz
Copy link
Member

👍

joelwurtz added a commit that referenced this pull request Jan 25, 2016
use options resolver where applicable, fix decoder plugin gzip handling
@joelwurtz joelwurtz merged commit baefb00 into master Jan 25, 2016
@joelwurtz joelwurtz deleted the options-resolver branch January 25, 2016 09:56

if ($this->useContentEncoding) {
$request = $request->withHeader('Accept-Encoding', ['gzip', 'deflate', 'compress']);
if ($this->useContentEncoding && count($encodings)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct that servers that respect Accept-Encoding will understand us when not sending this header? or should we send an empty header or something to say we can't handle encodings?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, from the RFC :

If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable.

And "identity" encoding = no encoding

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speak to quick

If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content coding. In this case, if "identity" is one of the available content-codings, then the server SHOULD use the "identity" content-coding, unless it has additional information that a different content-coding is meaningful to the client.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we should set a default header IMO and add identity to the encoding list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants